package com.zbkj.service.service;

import com.github.pagehelper.PageInfo;
import com.zbkj.dal.base.enums.BizSharedOrderStatus;
import com.zbkj.dal.base.enums.show.EnumShowVO;
import com.zbkj.dal.base.page.CommonPage;
import com.zbkj.dal.entity.ba.Share;
import com.zbkj.dal.pojo.request.OrderSendRequest;
import com.zbkj.dal.pojo.request.PageParamRequest;
import com.zbkj.dal.pojo.request.ShareQueryRequest;
import com.zbkj.dal.pojo.request.ba.ConcludeShareRequest;
import com.zbkj.dal.pojo.request.ba.UpdateFinalResultRequest;
import com.zbkj.dal.pojo.request.ba.UpdateInitialResultRequest;
import com.zbkj.dal.pojo.response.ba.ShareDetailResponse;
import com.zbkj.dal.pojo.response.ba.MyShareResponse;
import com.zbkj.dal.pojo.response.ba.ShareOrderCancelResponse;
import com.zbkj.dal.pojo.response.ba.ShareResponse;
import com.zbkj.dal.pojo.vo.LogisticsResultVo;
import com.zbkj.service.model.front.req.recycle.SupplyApplyCancelReq;
import com.zbkj.service.model.front.req.recycle.SupplyApplyReq;

import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 奢品共享 服务类
 * </p>
 *
 * @author jhui
 * @since 2023-10-03
 */
public interface ShareService {

    /**
     * 我的共享订单
     *
     * @param status
     * @param pageParamRequest
     * @return
     */
    CommonPage<MyShareResponse> listMyShare(String status, PageParamRequest pageParamRequest);

    /**
     * 删除我的奢品共享信息
     *
     * @param id
     * @return
     */
    Boolean deleteMyShare(Integer id);

    /**
     * 创建共享信息
     *
     * @param shareRequest
     * @return
     */
    Boolean create(SupplyApplyReq shareRequest);

    // 供享订单状态枚举列表
    List<EnumShowVO<String>> getOrderStatusList();

    /**
     * 分页查询共享信息
     *
     * @param shareQueryRequest
     * @return
     */
    PageInfo<ShareResponse> querySharesPaged(Integer merId, ShareQueryRequest shareQueryRequest, PageParamRequest pageParamRequest);

    /**
     * 判定结果
     *
     * @param concludeShareRequest
     */
    boolean conclude(ConcludeShareRequest concludeShareRequest);

    /**
     * 创建商品
     *
     * @param id
     * @return
     */
    boolean createProduct(Integer id);

    /**
     * 商品详情
     *
     * @param id
     * @return
     */
    ShareDetailResponse detail(String orderNo, Integer userId);

    /**
     * 根据商品获得共享信息
     *
     * @param productId
     * @return
     */
    Share getByProductId(Integer productId);

    /**
     * 根据商品获得共享信息
     *
     * @param orderNo
     * @return
     */
    Share getByOrderNo(String orderNo);

    ShareOrderCancelResponse cancel(SupplyApplyCancelReq orderNo);

    /**
     * 更新共享到店估价的预约时间
     *
     * @return 是否操作成功
     */
    Boolean updateShareEvaluationTime(String orderNo, LocalDateTime time, LocalDateTime end, Integer userId);

    Boolean updateShareExpressDelivery(String orderNo, Integer userId);

    /**
     * 修改初评结果
     */
    void updateShareInitialEvaluationResult(UpdateInitialResultRequest req);

    /**
     * 确认收货
     */
    Boolean confirmReceipt(String orderNo, Integer userId);

    /**
     * 确认提货
     *
     * @param deliveryCode 提货码
     * @param userId       用户ID
     * @param orderNo      订单号
     */
    Boolean confirmDelivery(String orderNo, String deliveryCode, Integer userId);

    /**
     * 发货
     */
    Boolean delivery(OrderSendRequest request);

    /**
     * 提交终评结果
     */
    void updateShareFinalEvaluationResult(UpdateFinalResultRequest request);


    /**
     * 修改终评估价
     */
    Boolean updateShareEstimatePrice(String orderNo, String estimatePrice);

    /**
     * 查看订单物流轨迹
     *
     * @param orderNo 订单号
     * @return List<LogisticsResultVo>
     */
    List<LogisticsResultVo> getLogistics(String orderNo);

    void estimateConfirm(String orderNo, Integer userId);

    Boolean updateSubStatusByOrderNo(String orderNo, BizSharedOrderStatus.SubStatus subStatus);

    Boolean updateByEntity(Share share);

    void returnDeliveryConfirm(String orderNo);
}
